//判断是否含有某个类名
function hasClass(elem, className) {
    return elem.className.indexOf(className) > -1;
}

//添加class
function addClass(elem, className) {
    if (!hasClass(elem, className)) {
        if (!new RegExp("(^|\\s)" + className + "(\\s|$)").test(elem.className)) elem.className += ' ' + className;
    }
}

//移除class
function removeClass(elem, className) {
    if (hasClass(elem, className)) {
        elem.className = elem.className.replace(new RegExp("(^|\\s)" + className + "(?=(\\s|$))", "g"), '');
    }
}

//验证是否时PC端
function isPC(){
    if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
        return false;
    } else {
        return true;
    }
}

//验证手机号码是否正确
function isMobile(s) {
	var patrn = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
	if (!patrn.exec(s))
		return false;
	return true;
}